Skip to content

Bump external/Java.Interop from 8d54473 to 6ec1345 - #11782

Merged
jonathanpeppers merged 5 commits into
mainfrom
dependabot/submodules/external/Java.Interop-6ec1345
Jul 1, 2026
Merged

Bump external/Java.Interop from 8d54473 to 6ec1345#11782
jonathanpeppers merged 5 commits into
mainfrom
dependabot/submodules/external/Java.Interop-6ec1345

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Jun 28, 2026

Copy link
Copy Markdown
Contributor

Bumps external/Java.Interop from 8d54473 to 6ec1345.

Commits

@dependabot dependabot Bot added dependencies Pull requests that update a dependency file. submodules Pull requests that update Submodules code labels Jun 28, 2026
Bumps [external/Java.Interop](https://github.com/dotnet/java-interop) from `8d54473` to `6ec1345`.
- [Commits](dotnet/java-interop@8d54473...6ec1345)

---
updated-dependencies:
- dependency-name: external/Java.Interop
  dependency-version: 6ec1345165fa7385c935f16ccaa8cc38be50a080
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot changed the title Bump external/Java.Interop from 7049364 to 6ec1345 Bump external/Java.Interop from 8d54473 to 6ec1345 Jun 30, 2026
@dependabot
dependabot Bot force-pushed the dependabot/submodules/external/Java.Interop-6ec1345 branch from 99a23fc to b0ce0ea Compare June 30, 2026 12:50
The Java.Runtime.Environment project was removed upstream in dotnet/java-interop#1447 (commit 4e142449), so the reference in Xamarin.Android.sln no longer resolves and breaks restore.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers

Copy link
Copy Markdown
Member

The 6 vs 4 warning delta on BuildHasNoWarningsTrueFalseaabNativeAOT comes from upstream dotnet/java-interop#1474 "Register JNI natives via blittable JniNativeMethod", which is included in this submodule bump. It added [RequiresDynamicCode] to two APIs we use:

  1. JniRuntime.ReflectionJniTypeManager (the class) — fires at Microsoft.Android.Runtime.ManagedTypeManager..ctor() because our ManagedTypeManager derives from it.
  2. JniEnvironment.Types.RegisterNatives(..., JniNativeMethodRegistration[], int) — fires at ManagedTypeManager.RegisterNativeMembers (src/Mono.Android/Microsoft.Android.Runtime/ManagedTypeManager.cs), which still calls the non-blittable overload.

(Each warning is reported twice — once per configuration — hence 2 new × 2 = 4 added on top of the preexisting JNINativeWrapper.CreateDelegateDynamicMethod IL3050.)

Suggested fix

In ManagedTypeManager.cs:

  • Migrate RegisterNativeMembers to marshal into the blittable JniNativeMethod struct and call the new RegisterNatives(JniObjectReference, ReadOnlySpan<JniNativeMethod>) overload (the whole point of upstream [Xamarin.Android.Build.Tasks] Fix an issue where the 'ref' nuget is not found on windows. #1474).
  • For the constructor warning, since ManagedTypeManager is the non-NativeAOT type manager (NativeAOT uses NativeAotTypeManager instead), suppress with [UnconditionalSuppressMessage ("AOT", "IL3050", ...)] and a justification.

jonathanpeppers and others added 3 commits June 30, 2026 10:00
…rNatives

Upstream dotnet/java-interop#1474 added [RequiresDynamicCode] to the JniNativeMethodRegistration[] overload of JniEnvironment.Types.RegisterNatives, which makes ManagedTypeManager.RegisterNativeMembers emit IL3050 under NativeAOT.

Marshal directly into blittable JniNativeMethod values (UTF-8 strings via Marshal.StringToCoTaskMemUTF8 + Marshal.GetFunctionPointerForDelegate) and call the blittable RegisterNatives(JniObjectReference, ReadOnlySpan<JniNativeMethod>) overload to eliminate the warning.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Upstream dotnet/java-interop#1474 added [RequiresDynamicCode] to:
 - JniRuntime.ReflectionJniTypeManager (the class), surfacing IL3050 at ManagedTypeManager..ctor() since we derive from it.
 - JniEnvironment.Types.RegisterNatives(.., JniNativeMethodRegistration[], int), surfacing IL3050 at ManagedTypeManager.RegisterNativeMembers.

Suppress both for now; the JniNativeMethodRegistration[] registration path will be migrated to the blittable RegisterNatives(JniObjectReference, ReadOnlySpan<JniNativeMethod>) overload in a future change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The ReflectionJniTypeManager [RequiresDynamicCode] attribute predates this submodule bump (added in dotnet/java-interop#1441), so the ManagedTypeManager..ctor() IL3050 is already part of the BuildHasNoWarnings test's baseline of 4 warnings. Only the RegisterNativeMembers warning is new from this PR; suppressing the ctor warning too would drop the count to 2 and fail the test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Jun 30, 2026
@jonathanpeppers
jonathanpeppers enabled auto-merge (squash) June 30, 2026 20:43
@jonathanpeppers
jonathanpeppers merged commit ad3f04b into main Jul 1, 2026
40 checks passed
@jonathanpeppers
jonathanpeppers deleted the dependabot/submodules/external/Java.Interop-6ec1345 branch July 1, 2026 08:40
jonathanpeppers added a commit that referenced this pull request Jul 6, 2026
…veMembers

dotnet/java-interop#1474 (pulled in by the Java.Interop bump in this PR)
adds [RequiresDynamicCode] to
JniEnvironment.Types.RegisterNatives(.., JniNativeMethodRegistration[], int),
surfacing a new IL3050 AOT analysis warning at
ManagedTypeManager.RegisterNativeMembers under NativeAOT. That broke
BuildHasNoWarnings(True,False,"apk",NativeAOT), which asserts an exact
warning count.

Suppress for now; the JniNativeMethodRegistration[] registration path will
be migrated to the blittable RegisterNatives(JniObjectReference,
ReadOnlySpan<JniNativeMethod>) overload in a future change. Mirrors the
companion change made on main in #11782.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
jonathanpeppers added a commit that referenced this pull request Jul 6, 2026
)

### Bump external/Java.Interop from `7049364` to `c24a8e9b`

Fixes a Release-mode startup crash in MAUI apps on preview.6:

    System.TypeInitializationException: ... Java.Interop.ManagedPeer
    ---> Java.Lang.IncompatibleClassChangeError: no static or non-static
    method "Lnet/dot/jni/ManagedPeer;.????"

Picks up dotnet/java-interop#1474 "Register JNI natives via blittable
JniNativeMethod", which reworks the RegisterNatives chokepoint to marshal
method names/signatures to UTF-8 ourselves and dispatch through the
blittable RegisterNatives(ReadOnlySpan<JniNativeMethod>) overload.

The old path passed a non-blittable JniNativeMethodRegistration[] through
a delegate* unmanaged<> call. dotnet/runtime#126911 moved array-of-struct
marshalling into a managed StructureMarshaler<T> whose blittable-only
fallback is miscompiled by crossgen2 under composite R2R + startup MIBC,
blitting a managed string reference into the native char* name and
corrupting the registered method names (the "????" above). This only
reproduces in Release (composite R2R + PGO), which is why Debug and
`dotnet new android` were unaffected while MAUI Release crashed.

Refs: #11633

### [Mono.Android] Suppress new IL3050 in ManagedTypeManager.RegisterNativeMembers

dotnet/java-interop#1474 (pulled in by the Java.Interop bump in this PR)
adds [RequiresDynamicCode] to
JniEnvironment.Types.RegisterNatives(.., JniNativeMethodRegistration[], int),
surfacing a new IL3050 AOT analysis warning at
ManagedTypeManager.RegisterNativeMembers under NativeAOT. That broke
BuildHasNoWarnings(True,False,"apk",NativeAOT), which asserts an exact
warning count.

Suppress for now; the JniNativeMethodRegistration[] registration path will
be migrated to the blittable RegisterNatives(JniObjectReference,
ReadOnlySpan<JniNativeMethod>) overload in a future change. Mirrors the
companion change made on main in #11782.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 31, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

dependencies Pull requests that update a dependency file. ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). submodules Pull requests that update Submodules code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants